package com.demo.Runtime;

import java.io.IOException;

public class RuntimeTest {
   public static void main(String[] args){
	   Runtime run=Runtime.getRuntime();
	   System.out.println(run.totalMemory());
	   System.out.println(run.maxMemory());
	   System.out.println(run.freeMemory());
	   System.out.println();
	   
	   String str="Hello world";
	   for(int i=0;i<1000;i++)
		   str=str+i;
	   //System.out.println(str);
	   run.gc();
	   System.out.println(run.freeMemory());
		
	   Process p = null;
	   try {
		p=run.exec("notepad.exe");
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}   
	   
	   try {
		Thread.sleep(5000);
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	   
	   p.destroy();
	   
   }
   
   
}
